﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StockHelper.Scripts.Types
{
    public class StockData
    {
        /// <summary>股票代码</summary>
        public string code = "";
        public string 名称 = "";
        public string 今日开盘价 = "";
        public string 昨日收盘价 = "";
        public string 当前价格 = "";
        public string 今日最高价 = "";
        public string 今日最低价 = "";
        public string 竞买价 = "";
        public string 竞卖价 = "";
        public string 成交数 = "";
        public string 成交金额 = "";
        public string 买一股票数 = "";
        public string 买一报价 = "";
        public string 买二股票数 = "";
        public string 买二报价 = "";
        public string 买三股票数 = "";
        public string 买三报价 = "";
        public string 买四股票数 = "";
        public string 买四报价 = "";
        public string 买五股票数 = "";
        public string 买五报价 = "";
        public string 卖一股票数 = "";
        public string 卖一报价 = "";
        public string 卖二股票数 = "";
        public string 卖二报价 = "";
        public string 卖三股票数 = "";
        public string 卖三报价 = "";
        public string 卖四股票数 = "";
        public string 卖四报价 = "";
        public string 卖五股票数 = "";
        public string 卖五报价 = "";
        public string 日期 = "";
        public string 时间 = "";
        public bool 是否涨价 = true;
        public float 涨跌值f = 0;
        public float 涨跌百分比f = 0;

        public string 涨跌值
        {
            get { return Math.Abs(涨跌值f).ToString("f2"); }
        }

        public string 涨跌百分比
        {
            get { return Math.Abs(涨跌百分比f * 100).ToString("f1") + "%"; }
        }

        public object Get(Param param)
        {
            switch (param)
            {
                case Param.code:
                    return code;
                case Param.名称:
                    return 名称;
                case Param.今日开盘价:
                    return 今日开盘价;
                case Param.昨日收盘价:
                    return 昨日收盘价;
                case Param.当前价格:
                    return 当前价格;
                case Param.今日最高价:
                    return 今日最高价;
                case Param.今日最低价:
                    return 今日最低价;
                case Param.竞买价:
                    return 竞买价;
                case Param.竞卖价:
                    return 竞卖价;
                case Param.成交数:
                    return 成交数;
                case Param.成交金额:
                    return 成交金额;
                case Param.买一股票数:
                    return 买一股票数;
                case Param.买一报价:
                    return 买一报价;
                case Param.买二股票数:
                    return 买二股票数;
                case Param.买二报价:
                    return 买二报价;
                case Param.买三股票数:
                    return 买三股票数;
                case Param.买三报价:
                    return 买三报价;
                case Param.买四股票数:
                    return 买四股票数;
                case Param.买四报价:
                    return 买四报价;
                case Param.买五股票数:
                    return 买五股票数;
                case Param.买五报价:
                    return 买五报价;
                case Param.卖一股票数:
                    return 卖一股票数;
                case Param.卖一报价:
                    return 卖一报价;
                case Param.卖二股票数:
                    return 卖二股票数;
                case Param.卖二报价:
                    return 卖二报价;
                case Param.卖三股票数:
                    return 卖三股票数;
                case Param.卖三报价:
                    return 卖三报价;
                case Param.卖四股票数:
                    return 卖四股票数;
                case Param.卖四报价:
                    return 卖四报价;
                case Param.卖五股票数:
                    return 卖五股票数;
                case Param.卖五报价:
                    return 卖五报价;
                case Param.日期:
                    return 日期;
                case Param.时间:
                    return 时间;
                case Param.涨跌值:
                    return 涨跌值;
                case Param.涨跌值f:
                    return 涨跌值f;
                case Param.是否涨价:
                    return 是否涨价;
                case Param.涨跌百分比:
                    return 涨跌百分比;
                case Param.涨跌百分比f:
                    return 涨跌百分比f;
            }
            return default;
        }

    }

    public enum Param
    {
        code,
        名称,
        今日开盘价,
        昨日收盘价,
        当前价格,
        今日最高价,
        今日最低价,
        竞买价,
        竞卖价,
        成交数,
        成交金额,
        买一股票数,
        买一报价,
        买二股票数,
        买二报价,
        买三股票数,
        买三报价,
        买四股票数,
        买四报价,
        买五股票数,
        买五报价,
        卖一股票数,
        卖一报价,
        卖二股票数,
        卖二报价,
        卖三股票数,
        卖三报价,
        卖四股票数,
        卖四报价,
        卖五股票数,
        卖五报价,
        日期,
        时间,
        涨跌值,
        涨跌值f,
        涨跌百分比,
        是否涨价,
        涨跌百分比f,
    }


}